selectionmodel: Change prototype of query_range()
authorBenjamin Otte <otte@redhat.com>
Mon, 11 Feb 2019 03:57:46 +0000 (04:57 +0100)
committerBenjamin Otte <otte@redhat.com>
Fri, 15 Feb 2019 05:28:35 +0000 (06:28 +0100)
commit1f56f5c2e97afdd6ab75a0826f13ea8608e8246c
treea605c2bca0417ccfccc0107588ea2ddc385c051a
parentcd37b872caba6765375bd8684957d302086ada92
selectionmodel: Change prototype of query_range()

1. Do not make position an inout variable
The function is meant to return a range for a given position, not modify
a position. So it makes no conceptual sense to use an inout variable.
2. Pass the selected state as an out variable
Using a boolean return value - in particular in an interface full of
boolean return values - makes the return value intuitively feel like a
success/failure return. Using an out variable clarifies the usage.
3. Allow passing every position value
Define what happens when position >= list.n_items
4. Clarify the docs about how this function should behave
In particular, mention the case from point (3)
5. Add more tests
Again, (3) needs testing.
gtk/gtkselectionmodel.c
gtk/gtkselectionmodel.h
gtk/gtksingleselection.c
testsuite/gtk/singleselection.c